{# Voice: what speaks and what listens (set in .env), every voice of the speaking provider with a play button, a sentence spoken in a chosen voice, and a file transcribed. Audio loads only when played. #} {% from "components/macros/layout.html" import card, facts %} {% from "components/macros/table.html" import data_table %} {% from "components/macros/form.html" import field, primary_button %} {% macro play(value) %}{% endmacro %}
{% call card("Speaking", "text to speech", id="ai-voice-speaking") %}{{ facts(speaking) }}{% endcall %} {% call card("Listening", "speech to text", id="ai-voice-listening") %}{{ facts(listening) }}{% endcall %}
{% call card("Voices", id="ai-voices") %} {{ data_table([ {"key": "name", "label": "Voice"}, {"key": "tone", "label": "Tone"}, {"key": "gender", "label": "Gender"}, {"key": "description", "label": "Description", "wrap": True}, {"key": "preview", "label": "Listen", "render": play}, ], voices, empty="This provider lists no voices") }} {% endcall %}
{% call card("Say something", id="ai-voice-try") %} {# The voice API's preview route speaks any text; the player just points at it. #}
{% call field("Voice") %}{% endcall %} {% call field("Text") %}{% endcall %}
{% endcall %} {% call card("Transcribe a file", id="ai-voice-transcribe") %}
{{ primary_button("Transcribe", "submit") }}
{% endcall %}